package com.shujia.mr.partition;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * 自定义分区类需要继承Partitioner，其泛型为Map端输出的Key和Value
 */
public class MyPartition extends Partitioner<Text,Student> {

    @Override
    public int getPartition(Text text, Student student, int numPartitions) {
        if (student.getGender().equals("男")) {
            return 0;
        }else{
            return 1;
        }
    }
}
